package com.axc.gallery2.edit;

import android.content.Context;
import android.graphics.Bitmap;

import com.axc.gallery2.function.INormalPen;
import com.axc.gallery2.function.IOtherPenShape;
import com.axc.gallery2.function.IPenStyle;
import com.axc.gallery2.function.IendActivity;

public class ScrawlAdapter {

	ISetScrawl iscrawl;
	IendActivity endActivity;
	IPenStyle penStyle;
	IPenShape penShape;
	INormalPen inormal;
	
	IOtherPenShape customerShape;

	public void setPenWidth(ISetScrawl iSetScrawl, float width) {
		iscrawl = iSetScrawl;
		iscrawl.setPenWidth(width);
	}

	public void newCanvas(ISetScrawl iSetScrawl) {
		iscrawl = iSetScrawl;
		iscrawl.newCanvas();
	}

	public void setPenColor(ISetScrawl iSetScrawl, int color) {
		iscrawl = iSetScrawl;
		iscrawl.setPenColor(color);
	}

	public void endActivity(IendActivity endActivity) {
		this.endActivity = endActivity;
		this.endActivity.endActivity();
	}

	public void Eraser(ISetScrawl iSetScrawl) {
		iscrawl = iSetScrawl;
		iscrawl.Eraser();
	}

	public void imagePen(IPenShape ipen,INormalPen normalPen, int style) {
		penShape = ipen;
		inormal=normalPen; 
		switch (style) {
		case 0:
			inormal.Normal();
			inormal.NoChangePen();
			break;
			//1-3顺序不可以变，涉及重刷三种图形
		case 1:
			penShape.HasChangePen();
			penShape.CircleShape();
			break;
		case 2:
			penShape.HasChangePen();
			penShape.rectangleShape(); 
			break;
		case 3: 
			penShape.HasChangePen();
			penShape.trigonShape();
			break;
		default:
			break;
		}
	}
	public void CustomerPen(IOtherPenShape shape,int imageid){
		penShape = (IPenShape) shape;
		customerShape=shape;
		CustomerShape(customerShape,imageid);
		penShape.HasChangePen();
	}
	public void CustomerShape(IOtherPenShape c,int imageID){
		c.LeaveShape(imageID);
	}
	public void MilPao(IOtherPenShape otherShape,int[]imageID,int w,int h,int count){
		customerShape=otherShape;
		customerShape.MilPao(imageID,w,h,count);  
	}
	public void setPenHollowStyle(IPenStyle style){
		penStyle = style;
		penStyle.setPenHollowStyle();
	}
	public void setPenfillStyle(IPenStyle style){
		penStyle = style;
		penStyle.setPenfillStyle();
	}
	public void SaveBitmap(Context cls,Bitmap bitmap){
		new SaveBitmap().Save(cls, bitmap);
	}
}
